package cn.tedu.controller;

import cn.tedu.dao.CarMapper;
import cn.tedu.pojo.Car;
import cn.tedu.service.CarService;
import cn.tedu.service.CarServicelmpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController //还有返回json串功能
@RequestMapping("car")
@CrossOrigin
public class CarController {
    @Autowired
    private CarService carService;

    @RequestMapping("get/{id}")
    public Car get(@PathVariable Integer id){
        Car byId = carService.getById(id);
        return byId;

    }
}
